<!DOCTYPE html>
<html lang="en">
    <!-- title -->


    

<!-- keywords -->



<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="author" content="ZHAI">
    <meta name="renderer" content="webkit">
    <meta name="copyright" content="ZHAI">
    
        <meta name="keywords" content="hexo,hexo-theme,hexo-blog">
    
    <meta name="description" content="">
    <meta name="description" content="一. 初识Sharding-JDBC1. Sharding-JDBC是什么？ Sharding-JDBC提供标准化的数据分片、分布式事务和数据库治理功能，定位为轻量级Java框架，在Java的JDBC层提供的额外服务。 它使用客户端直连数据库，以jar包形式提供服务，无需额外部署和依赖，可理解为增强版的JDBC驱动，完全兼容JDBC和各种ORM框架。适用于任何基于Java的ORM框架，如：JPA,">
<meta property="og:type" content="article">
<meta property="og:title" content="分库分表Sharding-JDBC">
<meta property="og:url" content="https://zhai_zhihui.gitee.io/posts/342f571b/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:description" content="一. 初识Sharding-JDBC1. Sharding-JDBC是什么？ Sharding-JDBC提供标准化的数据分片、分布式事务和数据库治理功能，定位为轻量级Java框架，在Java的JDBC层提供的额外服务。 它使用客户端直连数据库，以jar包形式提供服务，无需额外部署和依赖，可理解为增强版的JDBC驱动，完全兼容JDBC和各种ORM框架。适用于任何基于Java的ORM框架，如：JPA,">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="https://zhai_zhihui.gitee.io/posts/342f571b/webp-1685959324557-531.webp">
<meta property="og:image" content="https://zhai_zhihui.gitee.io/posts/342f571b/webp-1685959402920-536.webp">
<meta property="og:image" content="https://zhai_zhihui.gitee.io/posts/342f571b/webp-1685959418837-539.webp">
<meta property="og:image" content="https://zhai_zhihui.gitee.io/posts/342f571b/webp-1685959428860-542.webp">
<meta property="og:image" content="https://zhai_zhihui.gitee.io/posts/342f571b/webp-1685959439756-545.webp">
<meta property="og:image" content="https://zhai_zhihui.gitee.io/posts/342f571b/webp-1685959447590-548.webp">
<meta property="og:image" content="https://zhai_zhihui.gitee.io/posts/342f571b/webp-1685959453888-551.webp">
<meta property="og:image" content="https://zhai_zhihui.gitee.io/posts/342f571b/webp-1685959460322-554.webp">
<meta property="og:image" content="https://zhai_zhihui.gitee.io/posts/342f571b/webp-1685959468493-557.webp">
<meta property="og:image" content="https://zhai_zhihui.gitee.io/posts/342f571b/webp-1685959481164-560.webp">
<meta property="og:image" content="https://zhai_zhihui.gitee.io/posts/342f571b/webp-1685959493053-563.webp">
<meta property="article:published_time" content="2023-05-30T10:30:25.000Z">
<meta property="article:modified_time" content="2024-03-30T10:34:05.719Z">
<meta property="article:author" content="ZHAI">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://zhai_zhihui.gitee.io/posts/342f571b/webp-1685959324557-531.webp">
    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="icon" href="/assets/favicon.ico">
    
    <title>分库分表Sharding-JDBC · 翟 工作室</title>
    <!-- /*! loadCSS. [c]2017 Filament Group, Inc. MIT License */
/* This file is meant as a standalone workflow for
- testing support for link[rel=preload]
- enabling async CSS loading in browsers that do not support rel=preload
- applying rel preload css once loaded, whether supported or not.
*/ -->
<script>
    (function (w) {
        'use strict'
        // rel=preload support test
        if (!w.loadCSS) {
            w.loadCSS = function () {}
        }
        // define on the loadCSS obj
        var rp = (loadCSS.relpreload = {})
        // rel=preload feature support test
        // runs once and returns a function for compat purposes
        rp.support = (function () {
            var ret
            try {
                ret = w.document.createElement('link').relList.supports('preload')
            } catch (e) {
                ret = false
            }
            return function () {
                return ret
            }
        })()

        // if preload isn't supported, get an asynchronous load by using a non-matching media attribute
        // then change that media back to its intended value on load
        rp.bindMediaToggle = function (link) {
            // remember existing media attr for ultimate state, or default to 'all'
            var finalMedia = link.media || 'all'

            function enableStylesheet() {
                link.media = finalMedia
            }

            // bind load handlers to enable media
            if (link.addEventListener) {
                link.addEventListener('load', enableStylesheet)
            } else if (link.attachEvent) {
                link.attachEvent('onload', enableStylesheet)
            }

            // Set rel and non-applicable media type to start an async request
            // note: timeout allows this to happen async to let rendering continue in IE
            setTimeout(function () {
                link.rel = 'stylesheet'
                link.media = 'only x'
            })
            // also enable media after 3 seconds,
            // which will catch very old browsers (android 2.x, old firefox) that don't support onload on link
            setTimeout(enableStylesheet, 3000)
        }

        // loop through link elements in DOM
        rp.poly = function () {
            // double check this to prevent external calls from running
            if (rp.support()) {
                return
            }
            var links = w.document.getElementsByTagName('link')
            for (var i = 0; i < links.length; i++) {
                var link = links[i]
                // qualify links to those with rel=preload and as=style attrs
                if (
                    link.rel === 'preload' &&
                    link.getAttribute('as') === 'style' &&
                    !link.getAttribute('data-loadcss')
                ) {
                    // prevent rerunning on link
                    link.setAttribute('data-loadcss', true)
                    // bind listeners to toggle media back
                    rp.bindMediaToggle(link)
                }
            }
        }

        // if unsupported, run the polyfill
        if (!rp.support()) {
            // run once at least
            rp.poly()

            // rerun poly on an interval until onload
            var run = w.setInterval(rp.poly, 500)
            if (w.addEventListener) {
                w.addEventListener('load', function () {
                    rp.poly()
                    w.clearInterval(run)
                })
            } else if (w.attachEvent) {
                w.attachEvent('onload', function () {
                    rp.poly()
                    w.clearInterval(run)
                })
            }
        }

        // commonjs
        if (typeof exports !== 'undefined') {
            exports.loadCSS = loadCSS
        } else {
            w.loadCSS = loadCSS
        }
    })(typeof global !== 'undefined' ? global : this)
</script>

    <style type="text/css">
    @font-face {
        font-family: 'Oswald-Regular';
        src: url("/font/Oswald-Regular.ttf");
    }

    body {
        margin: 0;
    }

    header,
    footer,
    .back-top,
    .sidebar,
    .container,
    .site-intro-meta,
    .toc-wrapper {
        display: none;
    }

    .site-intro {
        position: relative;
        z-index: 3;
        width: 100%;
        /* height: 50vh; */
        overflow: hidden;
    }

    .site-intro-placeholder {
        position: absolute;
        z-index: -2;
        top: 0;
        left: 0;
        width: calc(100% + 300px);
        height: 100%;
        background: repeating-linear-gradient(-45deg, #444 0, #444 80px, #333 80px, #333 160px);
        background-position: center center;
        transform: translate3d(-226px, 0, 0);
        animation: gradient-move 2.5s ease-out 0s infinite;
    }

    @keyframes gradient-move {
        0% {
            transform: translate3d(-226px, 0, 0);
        }
        100% {
            transform: translate3d(0, 0, 0);
        }
    }
</style>

    <link rel="preload" href="/css/style.css?v=20211217" as="style" onload="this.onload=null;this.rel='stylesheet'">
    <link rel="preload" href="/css/dark.css?v=20211217" as="style">
    <link rel="stylesheet" href="/css/dark.css">
    <link rel="stylesheet" href="/css/mobile.css?v=20211217" media="(max-width: 960px)">
    <link rel="preload" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
    <link rel="preload" href="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" as="script">
    <link rel="preload" href="/scripts/main.js?v=20211217" as="script">
    <link rel="preload" href="/scripts/dark.js?v=20211217" as="script">
    <link rel="preload" href="/font/Oswald-Regular.ttf" as="font" crossorigin>
    <link rel="preload" href="https://at.alicdn.com/t/font_327081_1dta1rlogw17zaor.woff" as="font" crossorigin>
    <!-- algolia -->
    
        <script>
            var hits = JSON.parse('{"per_page":10}')
            var labels = JSON.parse('{"input_placeholder":"Search for Posts","hits_empty":"我们没有找到任何搜索结果: ${query}","hits_stats":"找到${hits}条结果（用时${time} ms）"}')

            var algolia = {
                applicationID: '3GGJLFV539',
                apiKey: '12968f8a240b5852b40b42867fa50e60',
                indexName: 'hexo',
                hits: hits,
                labels: labels
            }
        </script>
    
    <!-- 百度统计  -->
    
    <!-- 谷歌统计  -->
    
<meta name="generator" content="Hexo 6.3.0"></head>

    <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
    <script type="text/javascript">
        if (typeof window.$ == undefined) {
            console.warn('jquery load from jsdelivr failed, will load local script')
            document.write('<script src="/lib/jquery.min.js" />')
        }
    </script>
    
        <body class="post-body">
    
        <!-- header -->
        <header class="header header-mobile">
    <!-- top read progress line -->
    <div class="header-element">
        <div class="read-progress"></div>
    </div>
    <!-- sidebar menu button -->
    <div class="header-element">
        
            <div class="header-sidebar-menu">
        
            
                <div style="padding-left: 1px;">&#xe775;</div>
            
        </div>
    </div>
    <!-- header actions -->
    <div class="header-actions">
        <!-- theme mode switch button -->
        <span class="header-theme-btn header-element">
            <i class="fas fa-adjust"></i>
        </span>
        <!-- back to home page text -->
        <span class="home-link header-element">
            <a href=/>翟.</a>
        </span>
    </div>
    <!-- toggle banner for post layout -->
    
        
            <div class="banner">
        
            <div class="blog-title header-element">
                <a href="/">翟.</a>
            </div>
            <div class="post-title header-element">
                <a href="#" class="post-name">分库分表Sharding-JDBC</a>
            </div>
        </div>
    
</header>

        <!-- fixed footer -->
        <footer class="footer-fixed">
    <!-- back to top button -->
    <div class="footer-fixed-element">
        
            <div class="back-top back-top-hidden">
        
        
            <div>&#xe639;</div>
        
        </div>
    </div>
</footer>

        <!-- wrapper -->
        <div class="wrapper">
            <div class="site-intro" style="







    height:50vh;

">
    
    <!-- 主页  -->
    
        
    <!-- 404页  -->
    
    <div class="site-intro-placeholder"></div>
    <div class="site-intro-img" style="background-image: url(/intro/post-bg.jpg)"></div>
    <div class="site-intro-meta">
        <!-- 标题  -->
        <h1 class="intro-title">
            <!-- 主页  -->
            
                分库分表Sharding-JDBC
            <!-- 404 -->
            
        </h1>
        <!-- 副标题 -->
        <p class="intro-subtitle">
            <!-- 主页副标题  -->
            
                
            <!-- 404 -->
            
        </p>
        <!-- 文章页 meta -->
        
            <div class="post-intros">
                <!-- 文章页标签  -->
                
                    <div class= post-intro-tags >
    
    
</div>

                
                <!-- 文章字数统计 -->
                
                <div class="post-intro-meta">
                    <!-- 撰写日期 -->
                    <span class="iconfont-archer post-intro-calander">&#xe676;</span>
                    <span class="post-intro-time">2023/05/30</span>
                    <!-- busuanzi -->
                    
                        <span id="busuanzi_container_page_pv" class="busuanzi-pv">
                            <span class="iconfont-archer post-intro-busuanzi">&#xe602;</span>
                            <span id="busuanzi_value_page_pv"></span>
                        </span>
                    
                    <!-- 文章分享 -->
                    <span class="share-wrapper">
                        <span class="iconfont-archer share-icon">&#xe71d;</span>
                        <span class="share-text">Share</span>
                        <ul class="share-list">
                            <li class="iconfont-archer share-qr" data-type="qr">&#xe75b;
                                <div class="share-qrcode"></div>
                            </li>
                            <li class="iconfont-archer" data-type="weibo">&#xe619;</li>
                            <li class="iconfont-archer" data-type="qzone">&#xe62e;</li>
                            <li class="iconfont-archer" data-type="twitter">&#xe634;</li>
                            <li class="iconfont-archer" data-type="facebook">&#xe67a;</li>
                        </ul>
                    </span>
                </div>
            </div>
        
    </div>
</div>

            <script>
  // get user agent
  function getBrowserVersions() {
    var u = window.navigator.userAgent
    return {
      userAgent: u,
      trident: u.indexOf('Trident') > -1, //IE内核
      presto: u.indexOf('Presto') > -1, //opera内核
      webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
      gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
      mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
      ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
      android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器
      iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者安卓QQ浏览器
      iPad: u.indexOf('iPad') > -1, //是否为iPad
      webApp: u.indexOf('Safari') == -1, //是否为web应用程序，没有头部与底部
      weixin: u.indexOf('MicroMessenger') == -1, //是否为微信浏览器
      uc: u.indexOf('UCBrowser') > -1, //是否为android下的UC浏览器
    }
  }
  var browser = {
    versions: getBrowserVersions(),
  }
  console.log('userAgent: ' + browser.versions.userAgent)

  // callback
  function fontLoaded() {
    console.log('font loaded')
    if (document.getElementsByClassName('site-intro-meta')) {
      document
        .getElementsByClassName('intro-title')[0]
        .classList.add('intro-fade-in')
      document
        .getElementsByClassName('intro-subtitle')[0]
        .classList.add('intro-fade-in')
      var postIntros = document.getElementsByClassName('post-intros')[0]
      if (postIntros) {
        postIntros.classList.add('post-fade-in')
      }
    }
  }

  // UC不支持跨域，所以直接显示
  function asyncCb() {
    if (browser.versions.uc) {
      console.log('UCBrowser')
      fontLoaded()
    } else {
      WebFont.load({
        custom: {
          families: ['Oswald-Regular'],
        },
        loading: function () {
          // 所有字体开始加载
          // console.log('font loading');
        },
        active: function () {
          // 所有字体已渲染
          fontLoaded()
        },
        inactive: function () {
          // 字体预加载失败，无效字体或浏览器不支持加载
          console.log('inactive: timeout')
          fontLoaded()
        },
        timeout: 5000, // Set the timeout to two seconds
      })
    }
  }

  function asyncErr() {
    console.warn('script load from CDN failed, will load local script')
  }

  // load webfont-loader async, and add callback function
  function async(u, cb, err) {
    var d = document,
      t = 'script',
      o = d.createElement(t),
      s = d.getElementsByTagName(t)[0]
    o.src = u
    if (cb) {
      o.addEventListener(
        'load',
        function (e) {
          cb(null, e)
        },
        false
      )
    }
    if (err) {
      o.addEventListener(
        'error',
        function (e) {
          err(null, e)
        },
        false
      )
    }
    s.parentNode.insertBefore(o, s)
  }

  var asyncLoadWithFallBack = function (arr, success, reject) {
    var currReject = function () {
      reject()
      arr.shift()
      if (arr.length) async(arr[0], success, currReject)
    }

    async(arr[0], success, currReject)
  }

  asyncLoadWithFallBack(
    [
      'https://cdn.jsdelivr.net/npm/webfontloader@1.6.28/webfontloader.min.js',
      'https://cdn.bootcss.com/webfont/1.6.28/webfontloader.js',
      "/lib/webfontloader.min.js",
    ],
    asyncCb,
    asyncErr
  )
</script>

            <img class="loading" src="/assets/loading.svg" style="display: block; margin: 6rem auto 0 auto; width: 6rem; height: 6rem;" />
            <div class="container container-unloaded">
                <main class="main post-page">
    <article class="article-entry">
        <h3 id="一-初识Sharding-JDBC"><a href="#一-初识Sharding-JDBC" class="headerlink" title="一. 初识Sharding-JDBC"></a>一. 初识Sharding-JDBC</h3><p><strong>1. Sharding-JDBC是什么？</strong></p>
<p>Sharding-JDBC提供标准化的数据分片、分布式事务和数据库治理功能，定位为轻量级Java框架，在Java的JDBC层提供的额外服务。 它使用客户端直连数据库，以jar包形式提供服务，无需额外部署和依赖，可理解为增强版的JDBC驱动，完全兼容JDBC和各种ORM框架。<br>适用于任何基于Java的ORM框架，如：JPA, Hibernate, Mybatis, Spring JDBC Template或直接使用JDBC。<br>基于任何第三方的数据库连接池，如：DBCP, C3P0, BoneCP, Druid, HikariCP等。<br>支持任意实现JDBC规范的数据库。目前支持MySQL，Oracle，SQLServer和PostgreSQL。</p>
<p><strong>2. 为什么要分片？</strong></p>
<p>传统的将数据集中存储至单一数据节点的解决方案，在性能、可用性和运维成本这三方面已经难于满足互联网的海量数据场景。<br>从性能方面来说，由于关系型数据库大多采用B+树类型的索引，在数据量超过阈值的情况下，索引深度的增加也将使得磁盘访问的IO次数增加，进而导致查询性能的下降；同时，高并发访问请求也使得集中式数据库成为系统的最大瓶颈。<br>从可用性的方面来讲，服务化的无状态型，能够达到较小成本的随意扩容，这必然导致系统的最终压力都落在数据库之上。而单一的数据节点，或者简单的主从架构，已经越来越难以承担。数据库的可用性，已成为整个系统的关键。<br>从运维成本方面考虑，当一个数据库实例中的数据达到阈值以上，对于DBA的运维压力就会增大。数据备份和恢复的时间成本都将随着数据量的大小而愈发不可控。一般来讲，单一数据库实例的数据的阈值在1TB之内，是比较合理的范围。<br>在传统的关系型数据库无法满足互联网场景需要的情况下，将数据存储至原生支持分布式的NoSQL的尝试越来越多。 但NoSQL对SQL的不兼容性以及生态圈的不完善，使得它们在与关系型数据库的博弈中始终无法完成致命一击，而关系型数据库的地位却依然不可撼动。<br>数据分片指按照某个维度将存放在单一数据库中的数据分散地存放至多个数据库或表中以达到提升性能瓶颈以及可用性的效果。 数据分片的有效手段是对关系型数据库进行分库和分表。分库和分表均可以有效的避免由数据量超过可承受阈值而产生的查询瓶颈。 除此之外，分库还能够用于有效的分散对数据库单点的访问量；分表虽然无法缓解数据库压力，但却能够提供尽量将分布式事务转化为本地事务的可能，一旦涉及到跨库的更新操作，分布式事务往往会使问题变得复杂。 使用多主多从的分片方式，可以有效的避免数据单点，从而提升数据架构的可用性。<br>通过分库和分表进行数据的拆分来使得各个表的数据量保持在阈值以下，以及对流量进行疏导应对高访问量，是应对高并发和海量数据系统的有效手段。<br><strong>3. 分片的方式</strong></p>
<p>数据分片的拆分方式又分为垂直分片和水平分片。</p>
<p><strong>垂直拆分</strong>是把不同的表拆到不同的数据库中，而<strong>水平拆分</strong>是把同一个表拆到不同的数据库中（或者是把一张表数据拆分成n多个小表）。相对于垂直拆分，水平拆分不是将表的数据做分类，而是按照某个字段的某种规则来分散到多个库中，每个表中包含一部分数据。简单来说，我们可以将数据的水平切分理解为是按照数据行的切分，就是将表中的某些行切分到一个数据库，而另外某些行又切分到其他的数据库中，主要有分表，分库两种模式 该方式提高了系统的稳定性跟负载能力，但是跨库join性能较差。</p>
<p><strong>4. Sharding-JDBC的核心&#x2F;工原理</strong></p>
<p>Sharding-JDBC数据分片主要流程是由SQL解析 <strong>→</strong>执行器优化 **→ **SQL路由 <strong>→</strong>SQL改写 <strong>→</strong>SQL执行 <strong>→</strong>结果归并的流程组成。</p>
<p><strong>SQL解析</strong><br>分为词法解析和语法解析。 先通过词法解析器将SQL拆分为一个个不可再分的单词。再使用语法解析器对SQL进行理解，并最终提炼出解析上下文。 解析上下文包括表、选择项、排序项、分组项、聚合函数、分页信息、查询条件以及可能需要修改的占位符的标记。</p>
<p>SQL解析分为两步， 第一步为 词法解析， 词法解析的意思是就是将SQL进行拆分。<br>例：<br>select * from t_user where id &#x3D; 1<br>词法解析：<br>[select] [*] [from] [t_user] [where] [id&#x3D;1]<br>第二步语法解析,语法解析器将SQL转换为抽象语法树。</p>
<p><img src="/posts/342f571b/webp-1685959324557-531.webp" alt="img">](<a href="https://zhai_zhihui.gitee.io/posts/342f571b/webp-1685959324557-531.webp">https://zhai_zhihui.gitee.io/posts/342f571b/webp-1685959324557-531.webp</a>)</p>
<p><strong>执行器优化</strong><br>合并和优化分片条件，如OR等。</p>
<p><strong>SQL路由</strong><br>根据解析上下文匹配用户配置的分片策略，并生成路由路径。目前支持分片路由和广播路由。</p>
<p>举例说明，如果按照order_id的奇数和偶数进行数据分片，一个单表查询的SQL如下：<br>SELECT * FROM t_order WHERE order_id IN (1, 2);<br>那么路由的结果应为：<br>SELECT * FROM t_order_0 WHERE order_id IN (1, 2);<br>SELECT * FROM t_order_1 WHERE order_id IN (1, 2);</p>
<p><strong>SQL改写</strong><br>将SQL改写为在真实数据库中可以正确执行的语句，SQL改写分为正确性改写和优化改写。</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">从一个最简单的例子开始，若逻辑SQL为：</span><br><span class="line">SELECT order_id FROM t_order WHERE order_id=1;</span><br><span class="line">假设该SQL配置分片键order_id，并且order_id=1的情况，将路由至分片表1。那么改写之后的SQL应该为：</span><br><span class="line">SELECT order_id FROM t_order_1 WHERE order_id=1;</span><br></pre></td></tr></table></figure>

<p><strong>SQL执行</strong><br>通过多线程执行器异步执行。<br>结果归并<br>将多个执行结果集归并以便于通过统一的JDBC接口输出。结果归并包括流式归并、内存归并和使用装饰者模式的追加归并这几种方式。</p>
<h3 id="二-SpringBoot整合Sharding-JDBC"><a href="#二-SpringBoot整合Sharding-JDBC" class="headerlink" title="二. SpringBoot整合Sharding-JDBC"></a><strong>二. SpringBoot整合Sharding-JDBC</strong></h3><ol>
<li>创建两个数据库order1，order2，分别创建t_address表如下：</li>
</ol>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">DROP TABLE IF EXISTS `t_address`;</span><br><span class="line">CREATE TABLE `t_address` (</span><br><span class="line">  `id` bigint(20) NOT NULL,</span><br><span class="line">  `code` varchar(64) DEFAULT NULL COMMENT &#x27;编码&#x27;,</span><br><span class="line">  `name` varchar(64) DEFAULT NULL COMMENT &#x27;名称&#x27;,</span><br><span class="line">  `pid` varchar(64) NOT NULL DEFAULT &#x27;0&#x27; COMMENT &#x27;父id&#x27;,</span><br><span class="line">  `type` int(11) DEFAULT NULL COMMENT &#x27;1国家2省3市4县区&#x27;,</span><br><span class="line">  `lit` int(11) DEFAULT NULL,</span><br><span class="line">  PRIMARY KEY (`id`)</span><br><span class="line">) ENGINE=InnoDB DEFAULT CHARSET=utf8;</span><br></pre></td></tr></table></figure>

<ol>
<li>开始整合SpringBoot，这种方式比较简单只要加入sharding-jdbc-spring-boot-starter依赖，在application.yml中配置数据源，分片策略即可使用，这种方式简单，方便。</li>
</ol>
<p>pom.xml</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">&lt;dependency&gt;</span><br><span class="line">    &lt;groupId&gt;io.shardingsphere&lt;/groupId&gt;</span><br><span class="line">    &lt;artifactId&gt;sharding-jdbc-spring-boot-starter&lt;/artifactId&gt;</span><br><span class="line">    &lt;version&gt;3.0.0&lt;/version&gt;</span><br><span class="line">&lt;/dependency&gt;</span><br><span class="line">&lt;dependency&gt;</span><br><span class="line">    &lt;groupId&gt;io.shardingsphere&lt;/groupId&gt;</span><br><span class="line">    &lt;artifactId&gt;sharding-jdbc-spring-namespace&lt;/artifactId&gt;</span><br><span class="line">    &lt;version&gt;3.0.0&lt;/version&gt;</span><br><span class="line">&lt;/dependency&gt;</span><br></pre></td></tr></table></figure>

<p>** application.yml**</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br></pre></td><td class="code"><pre><span class="line">mybatis:</span><br><span class="line">  configuration:</span><br><span class="line">    mapUnderscoreToCamelCase: true</span><br><span class="line">sharding:</span><br><span class="line">  jdbc:</span><br><span class="line">    datasource:</span><br><span class="line">      names: ds0,ds1</span><br><span class="line">      ds0:</span><br><span class="line">        type: com.alibaba.druid.pool.DruidDataSource</span><br><span class="line">        driver-class-name: com.mysql.jdbc.Driver</span><br><span class="line">        url: jdbc:mysql://localhost:3306/order1</span><br><span class="line">        username: root</span><br><span class="line">        password: 123456</span><br><span class="line">      ds1:</span><br><span class="line">        type: com.alibaba.druid.pool.DruidDataSource</span><br><span class="line">        driver-class-name: com.mysql.jdbc.Driver</span><br><span class="line">        url: jdbc:mysql://localhost:3306/order2</span><br><span class="line">        username: root</span><br><span class="line">        password: 123456</span><br><span class="line">    config:</span><br><span class="line">      sharding:</span><br><span class="line">        props:</span><br><span class="line">          sql.show: true</span><br><span class="line">        tables:</span><br><span class="line">          t_user: #t_user表【即分库，又分表】</span><br><span class="line">            key-generator-column-name: id # 主键</span><br><span class="line">            actual-data-nodes: ds$&#123;0..1&#125;.t_user$&#123;0..1&#125; #数据节点</span><br><span class="line">            database-strategy: #分库策略</span><br><span class="line">              inline:</span><br><span class="line">                sharding-column: city_id</span><br><span class="line">                algorithm-expression: ds$&#123;city_id % 2&#125;</span><br><span class="line">            table-strategy: #分表策略</span><br><span class="line">              inline:</span><br><span class="line">                shardingColumn: sex</span><br><span class="line">                algorithm-expression: t_user$&#123;sex % 2&#125;</span><br><span class="line">          t_address: #t_address表【只分库】</span><br><span class="line">            key-generator-column-name: id</span><br><span class="line">            actual-data-nodes: ds$&#123;0..1&#125;.t_address</span><br><span class="line">            database-strategy:</span><br><span class="line">              inline:</span><br><span class="line">                shardingColumn: lit</span><br><span class="line">                algorithm-expression: ds$&#123;lit % 2&#125;</span><br></pre></td></tr></table></figure>

<p><strong>编写Dao</strong></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">@Mapper</span><br><span class="line">public interface IndexDao &#123;</span><br><span class="line"></span><br><span class="line">    @InsertProvider(type= AddressProvider.class,method=&quot;insertAddress&quot;)</span><br><span class="line">    @Options(useGeneratedKeys=true)</span><br><span class="line">    int insertAddress(AddressDo addressDo);</span><br><span class="line"></span><br><span class="line">    @Select(&quot;select * from t_address order by lit&quot;)</span><br><span class="line">    List&lt;AddressDo&gt; listAddress();</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p><strong>编写controller</strong></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line">@RestController</span><br><span class="line">public class IndexController &#123;</span><br><span class="line"></span><br><span class="line">    @Autowired</span><br><span class="line">    private IndexDao indexDao;</span><br><span class="line"></span><br><span class="line">    @PostMapping(&quot;/addAddress&quot;)</span><br><span class="line">    public ResultBO addAddress(AddressDo addressDo)&#123;</span><br><span class="line">        int row = indexDao.insertAddress(addressDo);</span><br><span class="line">        return ResultTool.success(row);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    @GetMapping(&quot;/listAddress&quot;)</span><br><span class="line">    public ResultBO listAddress(@RequestParam(required=false,defaultValue=&quot;1&quot;)Integer pageNum,</span><br><span class="line">                                @RequestParam(required=false,defaultValue=&quot;5&quot;)Integer pageSize)&#123;</span><br><span class="line">        PageHelper.startPage(pageNum,pageSize);</span><br><span class="line">        List&lt;AddressDo&gt; list =  indexDao.listAddress();</span><br><span class="line">        if(list.isEmpty())&#123;</span><br><span class="line">            ResultTool.success(&quot;查询内容为空&quot;);</span><br><span class="line">        &#125;</span><br><span class="line">        PageInfo&lt;AddressDo&gt; info = new PageInfo&lt;&gt;(list);</span><br><span class="line">        return ResultTool.success(info);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>此时，启动项目，用postman访问插入接口：</p>
<p><img src="/posts/342f571b/webp-1685959402920-536.webp" alt="img"></p>
<p><img src="/posts/342f571b/webp-1685959418837-539.webp" alt="img"></p>
<p><img src="/posts/342f571b/webp-1685959428860-542.webp" alt="img"></p>
<p><img src="/posts/342f571b/webp-1685959439756-545.webp" alt="img"></p>
<p><img src="/posts/342f571b/webp-1685959447590-548.webp" alt="img"></p>
<p>插入四条数据，可以看到两个库，两个表中的数据如下：</p>
<p><img src="/posts/342f571b/webp-1685959453888-551.webp" alt="img"></p>
<p><img src="/posts/342f571b/webp-1685959460322-554.webp" alt="img"></p>
<p>可以看到，根据lit字段进行分片（取模算法），因为我们指定的为2：**algorithm-expression: ds${lit % 2}**，所以奇数和偶数会存到不同的库不同的表中；并且需要注意的是，由于我们指定了**key-generator-column-name: id**，即自动生成主键，采用雪花算法Twitter-Snowflake。【不同的库】</p>
<p>下面我们用postman请求查询接口，访问：localhost:8080&#x2F;listAddress，查询结果为：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">    &quot;code&quot;: 0,</span><br><span class="line">    &quot;msg&quot;: &quot;成功&quot;,</span><br><span class="line">    &quot;data&quot;: &#123;</span><br><span class="line">        &quot;pageNum&quot;: 1,</span><br><span class="line">        &quot;pageSize&quot;: 2,</span><br><span class="line">        &quot;size&quot;: 2,</span><br><span class="line">        &quot;startRow&quot;: 1,</span><br><span class="line">        &quot;endRow&quot;: 2,</span><br><span class="line">        &quot;total&quot;: 4,</span><br><span class="line">        &quot;pages&quot;: 2,</span><br><span class="line">        &quot;list&quot;: [</span><br><span class="line">            &#123;</span><br><span class="line">                &quot;id&quot;: 363696781952811008,</span><br><span class="line">                &quot;code&quot;: &quot;1001&quot;,</span><br><span class="line">                &quot;name&quot;: &quot;济南&quot;,</span><br><span class="line">                &quot;pid&quot;: &quot;0&quot;,</span><br><span class="line">                &quot;type&quot;: 3,</span><br><span class="line">                &quot;lit&quot;: 1</span><br><span class="line">            &#125;,</span><br><span class="line">            &#123;</span><br><span class="line">                &quot;id&quot;: 363696816295772160,</span><br><span class="line">                &quot;code&quot;: &quot;1002&quot;,</span><br><span class="line">                &quot;name&quot;: &quot;青岛&quot;,</span><br><span class="line">                &quot;pid&quot;: &quot;0&quot;,</span><br><span class="line">                &quot;type&quot;: 3,</span><br><span class="line">                &quot;lit&quot;: 2</span><br><span class="line">            &#125;</span><br><span class="line">        ],</span><br><span class="line">        &quot;prePage&quot;: 0,</span><br><span class="line">        &quot;nextPage&quot;: 2,</span><br><span class="line">        &quot;isFirstPage&quot;: true,</span><br><span class="line">        &quot;isLastPage&quot;: false,</span><br><span class="line">        &quot;hasPreviousPage&quot;: false,</span><br><span class="line">        &quot;hasNextPage&quot;: true,</span><br><span class="line">        &quot;navigatePages&quot;: 8,</span><br><span class="line">        &quot;navigatepageNums&quot;: [</span><br><span class="line">            1,</span><br><span class="line">            2</span><br><span class="line">        ],</span><br><span class="line">        &quot;navigateFirstPage&quot;: 1,</span><br><span class="line">        &quot;navigateLastPage&quot;: 2,</span><br><span class="line">        &quot;firstPage&quot;: 1,</span><br><span class="line">        &quot;lastPage&quot;: 2</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>可以看到我们的order by 生效了，并且分页也生效了。</p>
<p><strong>【测试没有配过分片策略的表】</strong></p>
<p><img src="/posts/342f571b/webp-1685959468493-557.webp" alt="img"></p>
<p>如上图，只有order2数据库里有订单表address_order_table，此时我们想查询的话直接执行如下SQL语句即可：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">@Select(&quot;select * from order2.address_order_table&quot;)</span><br><span class="line">List&lt;OrderDo&gt; listOrder();</span><br></pre></td></tr></table></figure>

<p><strong>【测试关联查询】</strong></p>
<p>此时我们想关联查询order2库的address_order_table表和order1,order2库的t_address表，下图是address_order_table数据结构</p>
<p><img src="/posts/342f571b/webp-1685959481164-560.webp" alt="img"></p>
<p>如果想关联两个表，直接执行如下SQL语句即可：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">@Select(&quot;select a.id,a.address_number,a.order_remark from order2.address_order_table a inner join t_address b &quot; +</span><br><span class="line">        &quot;on a.address_number = b.id where b.id=#&#123;id&#125;&quot;)</span><br><span class="line">OrderDo getOrder(@Param(&quot;id&quot;)Long id);</span><br></pre></td></tr></table></figure>

<p><img src="/posts/342f571b/webp-1685959493053-563.webp" alt="img"></p>
<p><strong>【同一个库进行分表】</strong></p>
<p>上面是在不同的库进行分表，如果要想实现在同一个库下进行分表，则application.yml可以这样配置：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br></pre></td><td class="code"><pre><span class="line">mybatis:</span><br><span class="line">  configuration:</span><br><span class="line">    mapUnderscoreToCamelCase: true</span><br><span class="line">sharding:</span><br><span class="line">  jdbc:</span><br><span class="line">    datasource:</span><br><span class="line">      ####ds1</span><br><span class="line">      names: shardingjdbc</span><br><span class="line">      shardingjdbc:</span><br><span class="line">        type: com.alibaba.druid.pool.DruidDataSource</span><br><span class="line">        driver-class-name: com.mysql.jdbc.Driver</span><br><span class="line">        url: jdbc:mysql://127.0.0.1:3306/shardingjdbc</span><br><span class="line">        username: root</span><br><span class="line">        password: 123456</span><br><span class="line">####  分片配置（这些表都是需要提前在数据库创建好）【一般都是在单个库进行分表】</span><br><span class="line">    config:</span><br><span class="line">      sharding:</span><br><span class="line">        tables:</span><br><span class="line">          # t_order表分片策略</span><br><span class="line">          t_order:</span><br><span class="line">            table-strategy:</span><br><span class="line">              inline:</span><br><span class="line">                # 根据userid 进行分片</span><br><span class="line">                sharding-column: user_id</span><br><span class="line">                # ds_1.t_order_0 ds_1.t_order_1</span><br><span class="line">                algorithm-expression: shardingjdbc.t_order_$-&gt;&#123;user_id % 2&#125;</span><br><span class="line">              ###分表的总数 0到1   t_order_0 t_order_1</span><br><span class="line">            actual-data-nodes: shardingjdbc.t_order_$-&gt;&#123;0..1&#125;</span><br><span class="line">#         t_member:</span><br><span class="line">#           ...</span><br><span class="line">        props:</span><br><span class="line">          sql: </span><br><span class="line">          ### 开启分片日志</span><br><span class="line">            show: true</span><br></pre></td></tr></table></figure>

<p>解读：在数据库建立两张表：t_order_0和t_order_1，会根据user_id进行分片，取模2，即生成订单的时候，会根据userId进行判断，如果是用户id是计数，则存到t_order_1表，如果用户id是偶数，则存到t_order_0表中。</p>

    </article>
    <!-- license -->
    
        <div class="license-wrapper">
            <p>Author：<a href="https://zhai_zhihui.gitee.io">ZHAI</a>
            <p>Link：<a href="https://zhai_zhihui.gitee.io/posts/342f571b/">https://zhai_zhihui.gitee.io/posts/342f571b/</a>
            <p>Publish date：<a href="https://zhai_zhihui.gitee.io/posts/342f571b/">May 30th 2023, 6:30:25 pm</a>
            <p>Update date：<a href="https://zhai_zhihui.gitee.io/posts/342f571b/">March 30th 2024, 6:34:05 pm</a>
            <p>License：本文采用<a rel="license noopener" target="_blank" href="http://creativecommons.org/licenses/by-nc/4.0/">知识共享署名-非商业性使用 4.0 国际许可协议</a>进行许可</p>
        </div>
    
    <!-- paginator -->
    <ul class="post-paginator">
        <li class="next">
            
                <div class="nextSlogan">Next Post</div>
                <a href="/posts/7624ea2a/" title="品诺王版卤味">
                    <div class="nextTitle">品诺王版卤味</div>
                </a>
            
        </li>
        <li class="previous">
            
                <div class="prevSlogan">Previous Post</div>
                <a href="/posts/74214fa/" title="OpenVPN同时连多个vpn">
                    <div class="prevTitle">OpenVPN同时连多个vpn</div>
                </a>
            
        </li>
    </ul>
    <!-- comment -->
    
        <div class="post-comment">
            <!-- 来必力 City 版安装代码 -->


            

            

            

            <!-- utteranc评论 -->


            <!-- partial('_partial/comment/changyan') -->
            <!--PC版-->


            
            
    <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
    <script src='//unpkg.com/valine/dist/Valine.min.js'></script>
    <div id="comment"></div>
    <script>
        new Valine({
            el: '#comment',
            notify:false,
            verify:false,
            appId: "03H2Ay0YFmCc3Rk59ctLWuOK-gzGzoHsz",
            appKey: "kjtH05mMZzVhDksfF47nTRyQ",
            placeholder: "",
            path:window.location.pathname,
            avatar:'mm'
        });
    </script>


            

        </div>
    
    <!-- timeliness note -->
    <!-- idea from: https://hexo.fluid-dev.com/posts/hexo-injector/#%E6%96%87%E7%AB%A0%E6%97%B6%E6%95%88%E6%80%A7%E6%8F%90%E7%A4%BA -->
    
    <!-- Mathjax -->
    
</main>

                <!-- profile -->
                
            </div>
            <footer class="footer footer-unloaded">
    <!-- social  -->
    
        <div class="social">
            
    
        
            
                <a href="mailto:1828038025@qq.com" class="iconfont-archer email" title=email ></a>
            
        
    
        
            
                <a href="//gitee.com/zhai_zhihui" class="iconfont-archer github" target="_blank" title=github></a>
            
        
    
        
            
                <span class="iconfont-archer wechat" title=wechat>
                    
                    <img class="profile-qr" src="/assets/example_qr.png" />
                </span>
            
        
    
        
            
                <span class="iconfont-archer qq" title=qq>
                    
                    <img class="profile-qr" src="/assets/example_qr2.jpg" />
                </span>
            
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    


        </div>
    
    <!-- powered by Hexo  -->
    <div class="copyright">
        <span id="hexo-power">Powered by <a href="https://hexo.io/" target="_blank">Hexo</a></span><span class="iconfont-archer power">&#xe635;</span><span id="theme-info">theme <a href="https://github.com/fi3ework/hexo-theme-archer" target="_blank">Archer</a></span>
    </div>
    <!-- website approve for Chinese user -->
    
    <!-- 不蒜子  -->
    
        <div class="busuanzi-container">
            
             
                <span id="busuanzi_container_site_pv">PV: <span id="busuanzi_value_site_pv"></span> :)</span>
            
        </div>
    	
</footer>

        </div>
        <!-- toc -->
        
            <div class="toc-wrapper toc-wrapper-loding" style=







    top:50vh;

>
                <div class="toc-catalog">
                    <span class="iconfont-archer catalog-icon">&#xe613;</span><span>CATALOG</span>
                </div>
                <ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%B8%80-%E5%88%9D%E8%AF%86Sharding-JDBC"><span class="toc-number">1.</span> <span class="toc-text">一. 初识Sharding-JDBC</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BA%8C-SpringBoot%E6%95%B4%E5%90%88Sharding-JDBC"><span class="toc-number">2.</span> <span class="toc-text">二. SpringBoot整合Sharding-JDBC</span></a></li></ol>
            </div>
        
        <!-- sidebar -->
        <div class="sidebar sidebar-hide">
    <ul class="sidebar-tabs sidebar-tabs-active-0">
        <li class="sidebar-tab-archives"><span class="iconfont-archer">&#xe67d;</span><span class="tab-name">Archive</span></li>
        <li class="sidebar-tab-tags"><span class="iconfont-archer">&#xe61b;</span><span class="tab-name">Tag</span></li>
        <li class="sidebar-tab-categories"><span class="iconfont-archer">&#xe666;</span><span class="tab-name">Cate</span></li>
    </ul>
    <div class="sidebar-content sidebar-content-show-archive">
        <div class="sidebar-panel-archives">
    <!-- 在 ejs 中将 archive 按照时间排序 -->
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
    
    
    
    
    <div class="total-and-search">
        <div class="total-archive">
        Total : 51
        </div>
        <!-- search  -->
        
            <div class="site-search site-search-loading popup-trigger">
                <span class="iconfont-archer search-icon">&#xe627;</span>
            </div>
        
    </div>
    
    <div class="post-archive">
    
        
            
            
            <div class="archive-year"> 2024 </div>
            <ul class="year-list">
            
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/27</span>
            <a class="archive-post-title" href="/posts/f61093aa/">白斌-谈判技巧</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/24</span>
            <a class="archive-post-title" href="/posts/e4931d34/">5个ChatGPT搞钱成功案例</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/22</span>
            <a class="archive-post-title" href="/posts/c34d6d3f/">pua</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/cd2752f2/">如何在竞争对手强大繁多的困境突出重围？且看Insta360如何做到</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/20</span>
            <a class="archive-post-title" href="/posts/47fc87c9/">互联网公司架构</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/15</span>
            <a class="archive-post-title" href="/posts/881f29f/">Hexo加密</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/15</span>
            <a class="archive-post-title" href="/posts/2e543a56/">刻意练习</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/15</span>
            <a class="archive-post-title" href="/posts/50749798/">关于思维、强势文化、马克思主义、唯心主义、唯物主义的思考及对话</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/15</span>
            <a class="archive-post-title" href="/posts/d68051b9/">强势文化与弱势文化</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/12</span>
            <a class="archive-post-title" href="/posts/e8831614/">思维</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/12</span>
            <a class="archive-post-title" href="/posts/9a21e95f/">潜意识编辑</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/12</span>
            <a class="archive-post-title" href="/posts/3ad44071/">知行合一</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">03/30</span>
            <a class="archive-post-title" href="/posts/f1a9ae87/">字节跳动CEO张一鸣2014年采访</a>
        </li>
    
        
            
            
                
                </ul>
            
            <div class="archive-year"> 2023 </div>
            <ul class="year-list">
            
        
        <li class="archive-post-item">
            <span class="archive-post-date">10/18</span>
            <a class="archive-post-title" href="/posts/c42bcc42/">实体集合分页类</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">09/05</span>
            <a class="archive-post-title" href="/posts/91c508e3/">多线程实现异步</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">09/05</span>
            <a class="archive-post-title" href="/posts/cab7a692/">获取客户端外网ip</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">09/01</span>
            <a class="archive-post-title" href="/posts/56cc41e2/">朱厘米师傅的绉纱馄饨教程</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">08/31</span>
            <a class="archive-post-title" href="/posts/c66d13f4/">Linux使用curl发起post请求的常用方式</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">08/01</span>
            <a class="archive-post-title" href="/posts/688df240/">13 秒插入 30 万条数据</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">07/04</span>
            <a class="archive-post-title" href="/posts/7624ea2a/">品诺王版卤味</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">05/30</span>
            <a class="archive-post-title" href="/posts/342f571b/">分库分表Sharding-JDBC</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">05/17</span>
            <a class="archive-post-title" href="/posts/74214fa/">OpenVPN同时连多个vpn</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">05/17</span>
            <a class="archive-post-title" href="/posts/439c6055/">家人们谁懂啊这也太可爱了吧！</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">05/15</span>
            <a class="archive-post-title" href="/posts/c2569e69/">实体类集合转另一个实体类集合</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/27</span>
            <a class="archive-post-title" href="/posts/a5a91285/">hexo-abbrlink和hexo-asset-image插件冲突</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/27</span>
            <a class="archive-post-title" href="/posts/8b7ba7da/">Hexo+Algolia实现搜索</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/26</span>
            <a class="archive-post-title" href="/posts/ba39e0a3/">hexo+valine博客的评论功能</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/26</span>
            <a class="archive-post-title" href="/posts/28c0f33e/">JAVA计算大量数据接口怎么做</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/26</span>
            <a class="archive-post-title" href="/posts/e5c137a2/">判断字符串是否中英文类</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/26</span>
            <a class="archive-post-title" href="/posts/2a7156f8/">DM8自动生成代码</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/353f598a/">Hexo-零基础搭建个人博客(详解)</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/e5bae2ba/">Hexo搭配Typora图片问题</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/e55b8c2b/">java什么叫事务，事务有什么用</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/7deee04a/">java如何根据IP获取当前区域天气信息详解</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/3904c7be/">java计算判断时间是否大于15分钟</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/a6669b86/">linux部署jar包</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/dd843aa7/">mybatis判空提高效率</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/ea6a3de/">springboot项目启动时执行代码</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/30e6d251/">vscode插件好用的插件</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/24409baf/">使用IDEA根据wsdl生成WebServices客户端代码</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/918792c0/">判断集合是否有重复元素</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/6c39f264/">取差集工具类（高效率）</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/4c3f96ac/">客户端外网ip工具类</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/ea92058c/">使用流式数据处理检查list中是否有重复的元素并返回重复元素</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/90c8aa59/">查询字符串出现位置工具类</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/d6f28e22/">根据外网IP获取用户所在城市工具类</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/79be3dc6/">用SpringBoot连接redis并处理数据</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/2fa39047/">雪花算法生成ID工具类</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">04/21</span>
            <a class="archive-post-title" href="/posts/1eedc1b4/">markdown引入图片、音频、视频</a>
        </li>
    
        
            
            
                
                </ul>
            
            <div class="archive-year"> 2022 </div>
            <ul class="year-list">
            
        
        <li class="archive-post-item">
            <span class="archive-post-date">01/07</span>
            <a class="archive-post-title" href="/posts/4e2a03f/">java最便捷的word导出方法（POI-TL）</a>
        </li>
    
        
        <li class="archive-post-item">
            <span class="archive-post-date">01/07</span>
            <a class="archive-post-title" href="/posts/77673b17/">图片转 BASE64 编码</a>
        </li>
    
    </div>
</div>

        <div class="sidebar-panel-tags">
    <div class="sidebar-tags-name">
        
            <span class="sidebar-tag-name" data-tags="java">
                <span class="iconfont-archer">&#xe606;</span>
                java
            </span>
        
            <span class="sidebar-tag-name" data-tags="MyBatis">
                <span class="iconfont-archer">&#xe606;</span>
                MyBatis
            </span>
        
            <span class="sidebar-tag-name" data-tags="JDBC">
                <span class="iconfont-archer">&#xe606;</span>
                JDBC
            </span>
        
            <span class="sidebar-tag-name" data-tags="自动生成">
                <span class="iconfont-archer">&#xe606;</span>
                自动生成
            </span>
        
            <span class="sidebar-tag-name" data-tags="IDEA">
                <span class="iconfont-archer">&#xe606;</span>
                IDEA
            </span>
        
            <span class="sidebar-tag-name" data-tags="DM8">
                <span class="iconfont-archer">&#xe606;</span>
                DM8
            </span>
        
            <span class="sidebar-tag-name" data-tags="Node.js">
                <span class="iconfont-archer">&#xe606;</span>
                Node.js
            </span>
        
            <span class="sidebar-tag-name" data-tags="redis">
                <span class="iconfont-archer">&#xe606;</span>
                redis
            </span>
        
            <span class="sidebar-tag-name" data-tags="若依">
                <span class="iconfont-archer">&#xe606;</span>
                若依
            </span>
        
            <span class="sidebar-tag-name" data-tags="搭建">
                <span class="iconfont-archer">&#xe606;</span>
                搭建
            </span>
        
            <span class="sidebar-tag-name" data-tags="插件">
                <span class="iconfont-archer">&#xe606;</span>
                插件
            </span>
        
            <span class="sidebar-tag-name" data-tags="hexo-blog-encrypt">
                <span class="iconfont-archer">&#xe606;</span>
                hexo-blog-encrypt
            </span>
        
            <span class="sidebar-tag-name" data-tags="hexo-asset-image">
                <span class="iconfont-archer">&#xe606;</span>
                hexo-asset-image
            </span>
        
            <span class="sidebar-tag-name" data-tags="优化">
                <span class="iconfont-archer">&#xe606;</span>
                优化
            </span>
        
            <span class="sidebar-tag-name" data-tags="vpn">
                <span class="iconfont-archer">&#xe606;</span>
                vpn
            </span>
        
            <span class="sidebar-tag-name" data-tags="事务">
                <span class="iconfont-archer">&#xe606;</span>
                事务
            </span>
        
            <span class="sidebar-tag-name" data-tags="mysql">
                <span class="iconfont-archer">&#xe606;</span>
                mysql
            </span>
        
            <span class="sidebar-tag-name" data-tags="工具类">
                <span class="iconfont-archer">&#xe606;</span>
                工具类
            </span>
        
            <span class="sidebar-tag-name" data-tags="天气">
                <span class="iconfont-archer">&#xe606;</span>
                天气
            </span>
        
            <span class="sidebar-tag-name" data-tags="时间">
                <span class="iconfont-archer">&#xe606;</span>
                时间
            </span>
        
            <span class="sidebar-tag-name" data-tags="jar">
                <span class="iconfont-archer">&#xe606;</span>
                jar
            </span>
        
            <span class="sidebar-tag-name" data-tags="导出">
                <span class="iconfont-archer">&#xe606;</span>
                导出
            </span>
        
            <span class="sidebar-tag-name" data-tags="POI">
                <span class="iconfont-archer">&#xe606;</span>
                POI
            </span>
        
            <span class="sidebar-tag-name" data-tags="WORD">
                <span class="iconfont-archer">&#xe606;</span>
                WORD
            </span>
        
            <span class="sidebar-tag-name" data-tags="SpringBoot">
                <span class="iconfont-archer">&#xe606;</span>
                SpringBoot
            </span>
        
            <span class="sidebar-tag-name" data-tags="vscode">
                <span class="iconfont-archer">&#xe606;</span>
                vscode
            </span>
        
            <span class="sidebar-tag-name" data-tags="wsdl">
                <span class="iconfont-archer">&#xe606;</span>
                wsdl
            </span>
        
            <span class="sidebar-tag-name" data-tags="思维系统">
                <span class="iconfont-archer">&#xe606;</span>
                思维系统
            </span>
        
            <span class="sidebar-tag-name" data-tags="马克思主义">
                <span class="iconfont-archer">&#xe606;</span>
                马克思主义
            </span>
        
            <span class="sidebar-tag-name" data-tags="强势文化">
                <span class="iconfont-archer">&#xe606;</span>
                强势文化
            </span>
        
            <span class="sidebar-tag-name" data-tags="唯心主义">
                <span class="iconfont-archer">&#xe606;</span>
                唯心主义
            </span>
        
            <span class="sidebar-tag-name" data-tags="唯物主义">
                <span class="iconfont-archer">&#xe606;</span>
                唯物主义
            </span>
        
            <span class="sidebar-tag-name" data-tags="集合">
                <span class="iconfont-archer">&#xe606;</span>
                集合
            </span>
        
            <span class="sidebar-tag-name" data-tags="肉">
                <span class="iconfont-archer">&#xe606;</span>
                肉
            </span>
        
            <span class="sidebar-tag-name" data-tags="卤味">
                <span class="iconfont-archer">&#xe606;</span>
                卤味
            </span>
        
            <span class="sidebar-tag-name" data-tags="年夜饭">
                <span class="iconfont-archer">&#xe606;</span>
                年夜饭
            </span>
        
            <span class="sidebar-tag-name" data-tags="base64">
                <span class="iconfont-archer">&#xe606;</span>
                base64
            </span>
        
            <span class="sidebar-tag-name" data-tags="ip">
                <span class="iconfont-archer">&#xe606;</span>
                ip
            </span>
        
            <span class="sidebar-tag-name" data-tags="弱势文化">
                <span class="iconfont-archer">&#xe606;</span>
                弱势文化
            </span>
        
            <span class="sidebar-tag-name" data-tags="认知与实践">
                <span class="iconfont-archer">&#xe606;</span>
                认知与实践
            </span>
        
            <span class="sidebar-tag-name" data-tags="地理位置">
                <span class="iconfont-archer">&#xe606;</span>
                地理位置
            </span>
        
            <span class="sidebar-tag-name" data-tags="算法">
                <span class="iconfont-archer">&#xe606;</span>
                算法
            </span>
        
            <span class="sidebar-tag-name" data-tags="互联网">
                <span class="iconfont-archer">&#xe606;</span>
                互联网
            </span>
        
            <span class="sidebar-tag-name" data-tags="站在巨人肩膀上">
                <span class="iconfont-archer">&#xe606;</span>
                站在巨人肩膀上
            </span>
        
            <span class="sidebar-tag-name" data-tags="突围">
                <span class="iconfont-archer">&#xe606;</span>
                突围
            </span>
        
            <span class="sidebar-tag-name" data-tags="创新">
                <span class="iconfont-archer">&#xe606;</span>
                创新
            </span>
        
            <span class="sidebar-tag-name" data-tags="创业">
                <span class="iconfont-archer">&#xe606;</span>
                创业
            </span>
        
            <span class="sidebar-tag-name" data-tags="工具">
                <span class="iconfont-archer">&#xe606;</span>
                工具
            </span>
        
            <span class="sidebar-tag-name" data-tags="搞钱">
                <span class="iconfont-archer">&#xe606;</span>
                搞钱
            </span>
        
            <span class="sidebar-tag-name" data-tags="沟通">
                <span class="iconfont-archer">&#xe606;</span>
                沟通
            </span>
        
            <span class="sidebar-tag-name" data-tags="谈判">
                <span class="iconfont-archer">&#xe606;</span>
                谈判
            </span>
        
    </div>
    <div class="iconfont-archer sidebar-tags-empty">&#xe678;</div>
    <div class="tag-load-fail" style="display: none; color: #ccc; font-size: 0.6rem;">
        缺失模块，请参考主题文档进行安装配置：https://github.com/fi3ework/hexo-theme-archer#%E5%AE%89%E8%A3%85%E4%B8%BB%E9%A2%98
    </div> 
    <div class="sidebar-tags-list"></div>
</div>

        <div class="sidebar-panel-categories">
    <div class="sidebar-categories-name">
    
        <span class="sidebar-category-name" data-categories="代码">
            <span class="iconfont-archer">&#xe60a;</span>
            代码
        </span>
    
        <span class="sidebar-category-name" data-categories="hexo">
            <span class="iconfont-archer">&#xe60a;</span>
            hexo
        </span>
    
        <span class="sidebar-category-name" data-categories="linux">
            <span class="iconfont-archer">&#xe60a;</span>
            linux
        </span>
    
        <span class="sidebar-category-name" data-categories="工具">
            <span class="iconfont-archer">&#xe60a;</span>
            工具
        </span>
    
        <span class="sidebar-category-name" data-categories="markdown">
            <span class="iconfont-archer">&#xe60a;</span>
            markdown
        </span>
    
        <span class="sidebar-category-name" data-categories="哲学">
            <span class="iconfont-archer">&#xe60a;</span>
            哲学
        </span>
    
        <span class="sidebar-category-name" data-categories="美食">
            <span class="iconfont-archer">&#xe60a;</span>
            美食
        </span>
    
        <span class="sidebar-category-name" data-categories="小猫咪">
            <span class="iconfont-archer">&#xe60a;</span>
            小猫咪
        </span>
    
        <span class="sidebar-category-name" data-categories="互联网公司">
            <span class="iconfont-archer">&#xe60a;</span>
            互联网公司
        </span>
    
        <span class="sidebar-category-name" data-categories="ChatGPT">
            <span class="iconfont-archer">&#xe60a;</span>
            ChatGPT
        </span>
    
        <span class="sidebar-category-name" data-categories="人际交往">
            <span class="iconfont-archer">&#xe60a;</span>
            人际交往
        </span>
    
        <span class="sidebar-category-name" data-categories="沟通">
            <span class="iconfont-archer">&#xe60a;</span>
            沟通
        </span>
    
    </div>
    <div class="iconfont-archer sidebar-categories-empty">&#xe678;</div>
    <div class="sidebar-categories-list"></div>
</div>

    </div>
</div>

        <!-- site-meta -->
        <script>
    var siteMetaRoot = "/"
    if (siteMetaRoot === "undefined") {
        siteMetaRoot = '/'
    }
    var siteMeta = {
        url: "https://zhai_zhihui.gitee.io",
        root: siteMetaRoot,
        author: "ZHAI"
    }
</script>

        <!-- import experimental options here -->
        <!-- Custom Font -->


        <!-- main func -->
        <script src="/scripts/main.js?v=20211217"></script>
        <!-- dark mode -->
        <script src="/scripts/dark.js?v=20211217"></script>
        <!-- fancybox -->
        <script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js" defer></script>
        <!-- algolia -->
        
            <div class="site-search site-search-loading">
    <div class="algolia-popup popup">
        <div class="algolia-search">
            <div class="algolia-search-input-icon">
                <i class="fa fa-search"></i>
            </div>
            <div class="algolia-search-input" id="algolia-search-input"></div>
            <div class="popup-btn-close">
                <i class="iconfont-archer">&#xe609;</i>
            </div>
        </div>

        <div class="algolia-results">
            <div id="algolia-stats" class="algolia-stats"></div>
            <div id="algolia-hits"></div>
            <div id="algolia-pagination" class="algolia-pagination"></div>
        </div>
    </div>
</div>

            <script src="/scripts/search.js?v=20211217" defer></script>
        
        <!-- busuanzi -->
        
            <script src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" async></script>
        
        <!-- CNZZ -->
        
        <!-- async load share.js -->
        
            <script src="/scripts/share.js?v=20211217" async></script>
        
        <!-- mermaid -->
        
    </body>
</html>
